<?php

include_once('logic/view/View.php');

class BlogView extends View
{
    // admin
    function __construct()
    {
	parent::__construct("ADMINISTRATOR");
	$this->_xsl_template = 'template/blog_template.xsl';
	// comments element
	$this->_comments = $this->_root->appendChild($this->_xml_doc->createElement('comments'));
	// <comments>
	// ...
	// </comments>

	// imageinfos element
	$this->_imageinfos = $this->_root->appendChild($this->_xml_doc->createElement('imageinfos'));
	// <imageinfos>
	// ...
	// </imageinfos>

    }

    function addImageInfo($imageTitle,$imageDescription,$imageDate)
    {
    	//<imageinfo>
    	//	<title>$imageTitle</title>
    	//	<description>$imageDescription</description>
    	//	<date>$imageDate</date>
    	//</imageinfo>
    	$imageinfo = $this->_xml_doc->createElement('imageinfo');
    	$this->_imageinfos->appendChild($imageinfo);

    	$title_node = $imageinfo->appendChild($this->_xml_doc->createElement('title'));
		$title_node->appendChild($this->_xml_doc->createTextNode($imageTitle));
    	$description_node = $imageinfo->appendChild($this->_xml_doc->createElement('description'));
		$description_node->appendChild($this->_xml_doc->createTextNode($imageDescription));
    	$date_node = $imageinfo->appendChild($this->_xml_doc->createElement('date'));
		$date_node->appendChild($this->_xml_doc->createTextNode($imageDate));
    }

	function addComment($commentText,$commentDate,$commentName)
	{
		// <comment>
		//	 <date>$commentDate</date>
		//	 <name>$commentName</name>
		//   <text>$commentText</text>
		// </comment>
		$comment = $this->_xml_doc->createElement('comment');
		$this->_comments->appendChild($comment);

		$date_node = $comment->appendChild($this->_xml_doc->createElement('date'));
		$date_node->appendChild($this->_xml_doc->createTextNode($commentDate));
		$name_node = $comment->appendChild($this->_xml_doc->createElement('name'));
		$name_node->appendChild($this->_xml_doc->createTextNode($commentName));
		$text_node = $comment->appendChild($this->_xml_doc->createElement('text'));
		$text_node->appendChild($this->_xml_doc->createTextNode($commentText));

	}
}


?>
